package com.hxzy.module.admin.controller;

import cn.hutool.core.util.StrUtil;
import com.hxzy.common.web.resp.R;
import com.hxzy.module.admin.resp.AccountDetailResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@Api(tags = "后台用户管理")
@RequestMapping("/admin/account")
@Log4j2
public class AdminAccountController {


    @ApiOperation(value = "根据id查询")
    @GetMapping(value = "/{id}")
    public R<AccountDetailResp>  findById(@PathVariable(value = "id") String accountId,   @RequestHeader(value = "Authorization")String token ){

        if(StrUtil.isBlank(token)){
            throw new RuntimeException("无效令牌，请重新登录");
        }

        log.info(token);

        AccountDetailResp resp=new AccountDetailResp();
        resp.setAccountId(accountId);
        resp.setName("管理员");
        resp.setAccount("admin");

        return R.okHasData(resp);
    }



}
